{% import 'TopxiaWebBundle::macro.html.twig' as web_macro %}
<section class="class-header after {% if 'auditor' in member.role %} auditor{% endif %}">
  <div class="container">
  
    <ol class="breadcrumb breadcrumb-o">
      <li><a href="{{ path('homepage') }}">首页</a></li>
      {% for breadcrumb in breadcrumbs %}
        <li><a href="{{ path('classroom_explore',{'category':breadcrumb.code}) }}">{{ breadcrumb.name }}</a></li>
      {% endfor %}
      <li class="active">{{ classroom.title }}</li>
    </ol>

    <div class="class-header-mian">
      <div class="class-bg-layer"></div>
      <div class="class-header-bg clearfix">
        <div class="class-img">
          <a href="{{path('classroom_show',{id:classroom.id})}}">
            <img src="{{ filepath(classroom.largePicture, 'classroom.png') }}" alt="{{ classroom.title }}" href="{{path('classroom_show',{id:classroom.id})}}">
          </a>
        </div>
        <div class="class-info">
          <h2 class="title">
            {{ classroom.title }}
            <span class="es-qrcode top" data-url="{{path('classroom_qrcode',{id: classroom.id})}}">
              <i class="es-icon es-icon-qrcode"></i>
              <span class="qrcode-popover">
                <img src="" alt="">
                扫二维码继续学习
              </span>
            </span>
          </h2>
          <div class="metas">
            <div class="score">
              {{ web_macro.star(classroom.rating) }}
              <span>({{ classroom.ratingNum }}评价)</span>
            </div>
            {% if member.role == 'auditor'%}
              <div class="price">
                价格： <span>{% if setting('coin.coin_enabled') and setting('coin.price_type') == 'Coin' %}
                      {% if classroom.price > 0 %}
                     {{classroom.price * setting('coin.cash_rate') }} {{setting('coin.coin_name')}}
                      {% else %}
                      免费
                      {% endif %}
                  {% else %}
                    {% if classroom.price > 0 %}
                      {{ classroom.price }}元
                    {% else %}
                      免费
                    {% endif %}
                  {% endif %}</span>
              </div>
            {% endif %}
          </div>
          <div class="class-serve hidden-sm hidden-xs">
            <div class="serve-frame">
              承诺服务
            </div>
            {% include 'ClassroomBundle:Classroom:service-block.html.twig' with {'services':classroom.service} %}
          </div>
        </div>
        <div class="class-operation">
          <ul class='class-data clearfix two-col'>
            <li>
              <p><i class="es-icon es-icon-person"></i></p>
              <p>学员({{classroom.studentNum + classroom.auditorNum }})</p>
            </li>
            <li>
              <span class="es-share top">
                <a class="dropdown-toggle" href="" data-toggle="dropdown"  aria-labelledby="dropdownMenu1">
                  <p><i class="es-icon es-icon-share"></i></p>
                  <p>分享</p>
                </a>
                {% include 'TopxiaWebBundle:Common:share-dropdown.html.twig' with {type:'classroom'} %} 
              </span>
            </li>
          </ul>
          {% if 'auditor' in member.role %}
            <div class="class-auditor hidden-sm">
              您现在是<span class="color-warning">旁听生</span>，不能完整学习<i class="es-icon es-icon-help color-primary" data-toggle="tooltip" data-placement="top" title="" data-original-title="旁听生只能参与话题讨论，正式学员可以完整地学习所有内容，享受所有教学服务"></i><br>
              
              {% if setting("course.buy_fill_userinfo")|default(false) %}
                <a href="#modal" data-toggle="modal" data-url="{{ path('classroom_buy',{id:classroom.id}) }}" >立即加入购买</a>
              {% else %}
                <a href="{{path('order_show',{targetId:classroom.id,targetType:'classroom'})}}">立即加入购买</a>
              {% endif %}
              
            </div>
          {% endif %}
        </div>
      {% if classroom_permit(classroom.id, 'Manage') %}
        <a href="{{path('classroom_manage',{id:classroom.id})}}" class="btn btn-default setting hidden-xs hidden-sm" title="{{ setting('classroom.name')|default("班级") }}管理">
          <i class="es-icon es-icon-setting"></i>
        </a>
      {% elseif classroom_permit(classroom.id, 'Handle') %}
        <a href="{{ path('classroom_manage_testpaper', {id:classroom.id,status:'reviewing'}) }}" class="btn btn-default setting hidden-xs hidden-sm" title="{{ setting('classroom.name')|default("班级") }}管理">
          <i class="es-icon es-icon-setting"></i>
        </a>
      {% endif %}
      {% if classroom_permit(classroom.id, 'Take', true) and not isclassroomteacher|default(false) %}
        {% if 'headTeacher' not in member.role %}  
          <a type="button" 
            {% if  'student' in member.role and member.orderId > 0 %}
            class="btn btn-default setting hidden-xs hidden-sm"
            href="#modal" 
            data-toggle="modal" 
            data-url="{{path('order_refund', {id:classroom.id, targetType:'classroom'})}}"
            {% else %}
            class="btn btn-default setting hidden-xs hidden-sm"
            href="{{path('classroom_exit', {id:classroom.id})}}" id ="quit" 
            {% endif %}
            >
            <i class="es-icon es-icon-exit"></i>
          </a>
        {% endif %}
      {% endif %}
      </div>
    </div>
  </div>
</section>

{% if is_plugin_installed('ClassroomPlan') %}
  {{ render(controller('ClassroomPlanBundle:ClassroomPlan:joinPlanBlock',{classroomId:classroom.id})) }}
{% endif %}
